<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Login</title>
    <script src="/static/js/jquery.js"></script>
    <script>
        $(function () {
            $('body').css({'backgroundColor': '#ffeeac'})
                .find('h1').css({"fontSize": '40px', 'color': '#be8ef7'})
                .next().css({'color': '#89ffea', 'fontSize': '34px'})
                .children('#userName').css({'fontSize': '40px'})
                .parent().children('#pwd').css({'fontSize': '40px'})
                .parent()
                .next().css({"backgroundColor": '#99befa', 'fontSize': '40px'}).click(function () {

                let userName = $(this).prev().children('#userName').val()
                let pwd = $(this).prev().children('#pwd').val()

                if (userName.length === 0 || pwd.length === 0 || pwd.length > 12) {
                    alert('请输入正确登陆用户密码')
                }

                $.ajax({
                    url: '/app/login/loginAction/',
                    type: 'POST',
                    dataType: 'json',
                    data: {'userName': userName, 'password': pwd}
                }).done(function (res) {
                    if (res.success == '0') {
                        alert(res.msg)

                    }
                    if (res.success == '1') {
                        alert(res.msg)
                        location.href = '/app/login/index/'
                    }

                })
            })
        })
    </script>
</head>
<body>

<h1>请登陆</h1>

<div id="div1">

    登陆名: <input type="text" id="userName" value={{ userName }}><br>
    登陆密码: <input type="password" id="pwd">

</div>

<button>登陆</button>
</body>
</html>